package managedbean;

import java.io.IOException;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import session.stateless.SystemMessagesBean;
import util.localization.WebLocalization;

/**
 *
 * @author Swee Zhi
 * 
 * THIS BEAN IS FOR REDIRECTION PURPOSE ONLY!
 */
@ManagedBean(name = "pageRedirectorBean")
@RequestScoped
public class PageRedirectorBean implements Serializable {
    // EXCEPTION

    @EJB
    private SystemMessagesBean systemMessages;
    private WebLocalization localization;
    // preferred locale from session
    private String preferredLocale;
    private int serverPort;

    /** Creates a new instance of TouristLoginManagedBean */
    public PageRedirectorBean() {
        /* LOCALIZATION */
        localization = new WebLocalization();
        preferredLocale = localization.getPreferredLocaleFromSession();
        /* END LOCALIZATION */
    }

    public void initView(PhaseEvent event) {
        if (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().containsKey("serverPort")) {
            // if there is a previous session to pass the serverPort, retrieve the server port and destroy then create a new session and place the server port inside.
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            // clear previous session
            FacesContext.getCurrentInstance().getExternalContext().getSessionMap().clear();
            // create a new session and add the server port.
            FacesContext.getCurrentInstance().getExternalContext().getSession(true);
            FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("serverPort", serverPort);
        } else {
            serverPort = FacesContext.getCurrentInstance().getExternalContext().getRequestServerPort();
            FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("serverPort", serverPort);
        }
    }

    // same level home
    public void goHomePage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("index.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goTouristForgotPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("TouristForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/TouristForgotPassword.xhtml");

        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goTouristResetPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("TouristForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/TouristResetPassword.xhtml");

        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStaffForgotPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("StaffForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StaffForgotPassword.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goStaffResetPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("StaffForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StaffResetPassword.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStakeholderForgotPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("StakeholderForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StakeholderForgotPassword.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goStakeholderResetPassword() {
        try {
            // send tourist account ID to next page through http request
            //FacesContext.getCurrentInstance().getExternalContext().redirect("StakeholderForgotPassword.xhtml");

            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StakeholderResetPassword.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    // to amelia's branch

    public void goBranchPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("stakeholder/index.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    // to weihua's login
    public void goLoginPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("Login.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goTouristLoginPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("TouristLogin.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    // previous level ../TouristLogin.xhtml
    public void goTouristLoginPageAtPreviousLevel() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("../TouristLogin.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    // for already logged in users
    public void goTouristWelcomePage() {
        try {
            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/tourist/TouristViewMyFoodSage.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goEditMyFoodSagePage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("TouristEditMyFoodSage.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goEditStaffAccountPage() {
        try {
            // send staff account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("StaffEditAccount.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStaffLoginPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("StaffLogin.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    // previous level ../TouristLogin.xhtml
    public void goStaffLoginPageAtPreviousLevel() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("../StaffLogin.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    // for already logged in users
    public void goStaffWelcomePage() {
        try {
            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/staff/StaffViewAccount.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStaffChangeIntialPasswordPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("StaffChangeInitialPassword.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStakeholderLoginPage() {
        FacesContext ctx = FacesContext.getCurrentInstance();
        String nextPage = ctx.getExternalContext().encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/StakeholderLogin.xhtml"));
        try {
            ctx.getExternalContext().redirect(nextPage);
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }

    public void goStakeholderAccountPage() {
        String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
        serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
        String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
        //FacesContext ctx = FacesContext.getCurrentInstance();
        //String nextPage = ctx.getExternalContext().encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/stakeholder/ViewStakeholderAccount.xhtml"));

        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/stakeholder/ViewStakeholderAccount.xhtml");
            //ctx.getExternalContext().redirect(nextPage);
        } catch (IOException ex) {
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStakeholderRegisterPage() {
        try {
            String serverName = FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
            serverPort = (Integer) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("serverPort");
            String contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
            FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StakeholderRegister.xhtml");
        } catch (IOException ioe) {
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));

        }

    }
    // in same folder or level

    public void goTouristRegisterPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("TouristRegister.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goStaffRegisterPage() {
        try {
            // send tourist account ID to next page through http request
            FacesContext.getCurrentInstance().getExternalContext().redirect("staff/StaffRegister.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goItineraryCreateDIY() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryCreateDailyItineraryActivities.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goItineraryViewDailyItinerariesPage() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryViewDailyItineraries.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goItineraryCreateAuto() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryCreateAuto.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

//    public void goItineraryPreMade() {
//        try {
//            // send tourist account ID to next page through http request
//            FacesContext.getCurrentInstance().getExternalContext().redirect("staff/StaffRegister.xhtml");
//        } catch (IOException ex) {
//            // EXCEPTION
//            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
//            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
//        }
//    }
    public void goItineraryProvideTravelInfoPage() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryProvideTravelInfo.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public void goItineraryProvidePersonalPrefsPage() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryProvidePersonalPrefs.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goItineraryViewTripItineraryPage() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryViewTripItinerary.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
            
    public void goItineraryEditTripItineraryPage() {
        try {
            FacesContext ctx = FacesContext.getCurrentInstance();
            String nextPage = FacesContext.getCurrentInstance().getExternalContext().encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/itinerary/ItineraryEditDailyItinerary.xhtml"));
            FacesContext.getCurrentInstance().getExternalContext().redirect(nextPage);
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goItineraryViewDailyItineraryPage() {
        try {
            FacesContext.getCurrentInstance().getExternalContext().redirect("ItineraryViewDailyItinerary.xhtml");
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
            
    public void goItineraryEditDailyItineraryPage() {
        try {
            FacesContext ctx = FacesContext.getCurrentInstance();
            String nextPage = FacesContext.getCurrentInstance().getExternalContext().encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/itinerary/ItineraryEditDailyItinerary.xhtml"));
            FacesContext.getCurrentInstance().getExternalContext().redirect(nextPage);
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }
    
    public void goItineraryEditDailyItineraryActivitiesPage() {
        try {
            FacesContext ctx = FacesContext.getCurrentInstance();
            String nextPage = FacesContext.getCurrentInstance().getExternalContext().encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/itinerary/ItineraryEditDailyItinerary.xhtml"));
            FacesContext.getCurrentInstance().getExternalContext().redirect(nextPage);
        } catch (IOException ex) {
            // EXCEPTION
            String statusMessage = systemMessages.getSystemMessage("REDIRECT_FAIL", preferredLocale);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, statusMessage, ""));
        }
    }

    public SystemMessagesBean getSystemMessages() {
        return systemMessages;
    }

    public void setSystemMessages(SystemMessagesBean systemMessages) {
        this.systemMessages = systemMessages;
    }

    public WebLocalization getLocalization() {
        return localization;
    }

    public void setLocalization(WebLocalization localization) {
        this.localization = localization;
    }

    public String getPreferredLocale() {
        return preferredLocale;
    }

    public void setPreferredLocale(String preferredLocale) {
        this.preferredLocale = preferredLocale;
    }

    public int getServerPort() {
        return serverPort;
    }

    public void setServerPort(int serverPort) {
        this.serverPort = serverPort;
    }
}
